<!DOCTYPE html>
<html lang="zh-CN">

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="renderer" content="webkit">
		<title>测试页面</title>
		<style>
			body {
				margin: 0;
				text-align: center;
			}
			
			video {
				max-width: 1200px;
				width: 100%;
			}
		</style>
	</head>
	<script>
	</script>

	<body>
		<!--<script src="https://open.ys7.com/sdk/js/1.1/ezuikit.js"></script>-->
		<script src="./ezuikit.js"></script>
		<script src="jquery-3.2.1.min.js"></script>

		<video id="myPlayer" poster="" controls playsInline webkit-playsinline autoplay>
			<source src="rtmp://rtmp.open.ys7.com/openlive/3f89a31d4ce34fa6b294b66755855224.hd" type="" />
			<source src="http://hls.open.ys7.com/openlive/3f89a31d4ce34fa6b294b66755855224.hd.m3u8" type="application/x-mpegURL" />

		</video>

		<script>
			var player = new EZUIPlayer('myPlayer');
			player.on('error', function() {
				console.log('error');
			});
			player.on('play', function() {
				console.log('play');
			});
			player.on('pause', function() {
				console.log('pause');
			});

			document.onkeydown = function(event) {
				var e = event || window.event || arguments.callee.caller.arguments[0];
				var keyCode;
				switch(e.keyCode) {
					case 38:
						keyCode = 0;
						break;
					case 37:
						keyCode = 2;
						break;
					case 40:
						keyCode = 1;
						break;
					case 39:
						keyCode = 3;
						break;
				}
				var data = {
					accessToken: 'at.anp9nu102h0ytzz5c59x449hc89poty4-8kx6girw3f-0g589lj-xptf4cver',
					deviceSerial: '794607951',
					channelNo: 1,
					direction: keyCode,
					speed: 1
				}

				function success(res) {
					console.log('success');
				}
				//		$.post('https://open.ys7.com/api/lapp/device/ptz/start',data,success);
				$.ajax({
					type: "post",
					url: "https://open.ys7.com/api/lapp/device/ptz/start",
					data: data,
					headers: {
//						'Host': 'open.ys7.com',
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					success: function(res) {
						console.log('success');
					}
				});
			}
		</script>
	</body>

</html>